﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management.master" AutoEventWireup="true"
    CodeFile="proposal_report.aspx.cs" EnableEventValidation="false" Inherits="management_proposal_report" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <style type="text/css">
        .modalBackground
        {
            background-color: Gray;
            filter: alpha(opacity=40);
            opacity: 0.5;
        }
        .ModalWindow
        {
            border: solid1px#c0c0c0;
            background: #f0f0f0;
            padding: 0px10px10px10px;
            position: absolute;
            top: -1000px;
        }
    </style>
    <div class="contents">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <table width="100%" cellpadding="3" cellspacing="0" border="0">
            <tr>
                <td>
                    <h1>
                        Car - Completed Submission Reports</h1>
                </td>
            </tr>
            <tr id="trSearch" runat="server">
                <td>
                    <table cellpadding="0" cellspacing="2" border="0">
                        <tr>
                            <td style="width: 80px; height: 30px;">
                                <b>Campaign</b> :
                            </td>
                            <td style="width: 100px;">
                                <asp:DropDownList ID="ddlCampaign" runat="server">
                                    <asp:ListItem Value="400" Selected="True">On-line</asp:ListItem>
                                    <asp:ListItem Value="1001">Off-line</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td style="width: 80px;">
                                <b>Insurer</b> :
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlProvider" runat="server" Width="60">
                                    <asp:ListItem Value="0">All</asp:ListItem>
                                    <asp:ListItem Value="11">Allianz</asp:ListItem>
                                    <asp:ListItem Value="16">AXA</asp:ListItem>
                                    <asp:ListItem Value="32">BKI</asp:ListItem>
                                    <asp:ListItem Value="31">Chartis</asp:ListItem>
                                    <asp:ListItem Value="29">LMG</asp:ListItem>
                                    <asp:ListItem Value="12">MSIG</asp:ListItem>
                                    <asp:ListItem Value="33">MTI</asp:ListItem>
                                    <asp:ListItem Value="35">KPI</asp:ListItem>
                                    <asp:ListItem Value="39">Mittare</asp:ListItem>
                                    <asp:ListItem Value="41">Kurnia</asp:ListItem>
                                    <asp:ListItem Value="46">TMS</asp:ListItem>
                                </asp:DropDownList>
                                &nbsp; <b>Insurance Type</b> :
                                <asp:DropDownList ID="ddlInsuranceType" runat="server" Width="75">
                                    <asp:ListItem Value="0">All</asp:ListItem>
                                    <asp:ListItem Value="10">Class 1</asp:ListItem>
                                    <asp:ListItem Value="11">Class 1(Low Cost)</asp:ListItem>
                                    <asp:ListItem Value="21">Class 2+</asp:ListItem>
                                    <asp:ListItem Value="31">Class 3+</asp:ListItem>
                                    <asp:ListItem Value="30">Class 3</asp:ListItem>
                                </asp:DropDownList>
                                &nbsp; <b>App Type</b> :
                                <asp:DropDownList ID="ddlApplicationType" runat="server" Width="75">
                                    <asp:ListItem Value="0">All</asp:ListItem>
                                    <asp:ListItem Value="NEW">New</asp:ListItem>
                                    <asp:ListItem Value="REN">Renewal with Same Insurer</asp:ListItem>
                                    <asp:ListItem Value="RNO">Renewal with Other Insurer</asp:ListItem>
                                    <asp:ListItem Value="CHB">Change from Other Broker</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 80px; height: 30px;">
                                <b>Report Type</b> :
                            </td>
                            <td style="width: 100px;">
                                <asp:DropDownList ID="ddlReportType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlReportType_SelectedIndexChanged">
                                    <asp:ListItem Value="0">Monthly</asp:ListItem>
                                    <asp:ListItem Value="1" Selected="True">Daily</asp:ListItem>
                                    <asp:ListItem Value="2">Customize</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td style="width: 80px;">
                                <b>
                                    <asp:Label ID="lblFromDate" runat="server"></asp:Label></b>
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlDay1" runat="server" ToolTip="Choose Day">
                                    <asp:ListItem Value="01">01</asp:ListItem>
                                    <asp:ListItem Value="02">02</asp:ListItem>
                                    <asp:ListItem Value="03">03</asp:ListItem>
                                    <asp:ListItem Value="04">04</asp:ListItem>
                                    <asp:ListItem Value="05">05</asp:ListItem>
                                    <asp:ListItem Value="06">06</asp:ListItem>
                                    <asp:ListItem Value="07">07</asp:ListItem>
                                    <asp:ListItem Value="08">08</asp:ListItem>
                                    <asp:ListItem Value="09">09</asp:ListItem>
                                    <asp:ListItem Value="10">10</asp:ListItem>
                                    <asp:ListItem Value="11">11</asp:ListItem>
                                    <asp:ListItem Value="12">12</asp:ListItem>
                                    <asp:ListItem Value="13">13</asp:ListItem>
                                    <asp:ListItem Value="14">14</asp:ListItem>
                                    <asp:ListItem Value="15">15</asp:ListItem>
                                    <asp:ListItem Value="16">16</asp:ListItem>
                                    <asp:ListItem Value="17">17</asp:ListItem>
                                    <asp:ListItem Value="18">18</asp:ListItem>
                                    <asp:ListItem Value="19">19</asp:ListItem>
                                    <asp:ListItem Value="20">20</asp:ListItem>
                                    <asp:ListItem Value="21">21</asp:ListItem>
                                    <asp:ListItem Value="22">22</asp:ListItem>
                                    <asp:ListItem Value="23">23</asp:ListItem>
                                    <asp:ListItem Value="24">24</asp:ListItem>
                                    <asp:ListItem Value="25">25</asp:ListItem>
                                    <asp:ListItem Value="26">26</asp:ListItem>
                                    <asp:ListItem Value="27">27</asp:ListItem>
                                    <asp:ListItem Value="28">28</asp:ListItem>
                                    <asp:ListItem Value="29">29</asp:ListItem>
                                    <asp:ListItem Value="30">30</asp:ListItem>
                                    <asp:ListItem Value="31">31</asp:ListItem>
                                </asp:DropDownList>
                                <asp:DropDownList ID="ddlMonth1" runat="server">
                                    <asp:ListItem Value="01">Jan</asp:ListItem>
                                    <asp:ListItem Value="02">Feb</asp:ListItem>
                                    <asp:ListItem Value="03">Mar</asp:ListItem>
                                    <asp:ListItem Value="04">Apr</asp:ListItem>
                                    <asp:ListItem Value="05">May</asp:ListItem>
                                    <asp:ListItem Value="06">Jun</asp:ListItem>
                                    <asp:ListItem Value="07">Jul</asp:ListItem>
                                    <asp:ListItem Value="08">Aug</asp:ListItem>
                                    <asp:ListItem Value="09">Sep</asp:ListItem>
                                    <asp:ListItem Value="10">Oct</asp:ListItem>
                                    <asp:ListItem Value="11">Nov</asp:ListItem>
                                    <asp:ListItem Value="12">Dec</asp:ListItem>
                                </asp:DropDownList>
                                <asp:DropDownList ID="ddlYear1" runat="server">
                                    <asp:ListItem Value="2010">2010</asp:ListItem>
                                    <asp:ListItem Value="2011">2011</asp:ListItem>
                                    <asp:ListItem Value="2012">2012</asp:ListItem>
                                    <asp:ListItem Value="2013">2013</asp:ListItem>
                                </asp:DropDownList>
                                <b>
                                    <asp:Label ID="lblToDate" runat="server"></asp:Label></b>
                                <asp:DropDownList ID="ddlDay2" runat="server" ToolTip="Choose Day">
                                    <asp:ListItem Value="01">01</asp:ListItem>
                                    <asp:ListItem Value="02">02</asp:ListItem>
                                    <asp:ListItem Value="03">03</asp:ListItem>
                                    <asp:ListItem Value="04">04</asp:ListItem>
                                    <asp:ListItem Value="05">05</asp:ListItem>
                                    <asp:ListItem Value="06">06</asp:ListItem>
                                    <asp:ListItem Value="07">07</asp:ListItem>
                                    <asp:ListItem Value="08">08</asp:ListItem>
                                    <asp:ListItem Value="09">09</asp:ListItem>
                                    <asp:ListItem Value="10">10</asp:ListItem>
                                    <asp:ListItem Value="11">11</asp:ListItem>
                                    <asp:ListItem Value="12">12</asp:ListItem>
                                    <asp:ListItem Value="13">13</asp:ListItem>
                                    <asp:ListItem Value="14">14</asp:ListItem>
                                    <asp:ListItem Value="15">15</asp:ListItem>
                                    <asp:ListItem Value="16">16</asp:ListItem>
                                    <asp:ListItem Value="17">17</asp:ListItem>
                                    <asp:ListItem Value="18">18</asp:ListItem>
                                    <asp:ListItem Value="19">19</asp:ListItem>
                                    <asp:ListItem Value="20">20</asp:ListItem>
                                    <asp:ListItem Value="21">21</asp:ListItem>
                                    <asp:ListItem Value="22">22</asp:ListItem>
                                    <asp:ListItem Value="23">23</asp:ListItem>
                                    <asp:ListItem Value="24">24</asp:ListItem>
                                    <asp:ListItem Value="25">25</asp:ListItem>
                                    <asp:ListItem Value="26">26</asp:ListItem>
                                    <asp:ListItem Value="27">27</asp:ListItem>
                                    <asp:ListItem Value="28">28</asp:ListItem>
                                    <asp:ListItem Value="29">29</asp:ListItem>
                                    <asp:ListItem Value="30">30</asp:ListItem>
                                    <asp:ListItem Value="31">31</asp:ListItem>
                                </asp:DropDownList>
                                <asp:DropDownList ID="ddlMonth2" runat="server">
                                    <asp:ListItem Value="01">Jan</asp:ListItem>
                                    <asp:ListItem Value="02">Feb</asp:ListItem>
                                    <asp:ListItem Value="03">Mar</asp:ListItem>
                                    <asp:ListItem Value="04">Apr</asp:ListItem>
                                    <asp:ListItem Value="05">May</asp:ListItem>
                                    <asp:ListItem Value="06">Jun</asp:ListItem>
                                    <asp:ListItem Value="07">Jul</asp:ListItem>
                                    <asp:ListItem Value="08">Aug</asp:ListItem>
                                    <asp:ListItem Value="09">Sep</asp:ListItem>
                                    <asp:ListItem Value="10">Oct</asp:ListItem>
                                    <asp:ListItem Value="11">Nov</asp:ListItem>
                                    <asp:ListItem Value="12">Dec</asp:ListItem>
                                </asp:DropDownList>
                                <asp:DropDownList ID="ddlYear2" runat="server">
                                    <asp:ListItem Value="2010">2010</asp:ListItem>
                                    <asp:ListItem Value="2011">2011</asp:ListItem>
                                    <asp:ListItem Value="2012">2012</asp:ListItem>
                                    <asp:ListItem Value="2013">2013</asp:ListItem>
                                </asp:DropDownList>
                                <div style="display: none">
                                    <asp:TextBox ID="txtReportDate1" runat="server"></asp:TextBox>
                                    <asp:TextBox ID="txtReportDate2" runat="server"></asp:TextBox>
                                    <asp:TextBox ID="txtCEID" runat="server" Text="0"></asp:TextBox>
                                    &nbsp; <b>Language</b> :
                                    <asp:DropDownList ID="ddlLanguage" runat="server">
                                        <asp:ListItem Value="EN">English</asp:ListItem>
                                        <asp:ListItem Value="TH">Thai</asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                                &nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr id="trRecordCount" runat="server">
                <td>
                    <div id="divLegend" runat="server" visible="false">
                        <asp:Label ID="lblRecordCount" runat="server"></asp:Label>
                        <span style='color: #8A0808; font-size: 14px; font-weight: bold;'>&nbsp;&nbsp;APP TYPE
                            :&nbsp;</span> <span style='color: #B4045F; font-size: 14px; font-weight: bold;'>&nbsp;&nbsp;"NEW"
                                - New&nbsp;&nbsp;</span>| <span style='color: #04B404; font-size: 14px; font-weight: bold;'>
                                    &nbsp;&nbsp;"REN" - Renewal with Same Insurer&nbsp;&nbsp;</span>| <span style='color: #0000FF;
                                        font-size: 14px; font-weight: bold;'>&nbsp;&nbsp;"RNO" - Renewal with Other Insurer&nbsp;&nbsp;</span>|
                        <span style='color: #DF0101; font-size: 14px; font-weight: bold;'>&nbsp;&nbsp;"CHB"
                            - Change from Other Broker</span> <span class="admin_gridstyle" style="float: right;
                                padding-right: 5px">
                                <asp:HyperLink Visible="false" ID="hplPrint" NavigateUrl="" Target="_blank" runat="server"><img src="images/icons/icon_print.png" alt="print preview" /></asp:HyperLink>
                            </span>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
                    <asp:GridView ID="grvProposalSummary" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                        CellSpacing="3" CellPadding="3" Width="100%" CssClass="admin_gridstyle" PagerStyle-CssClass="pgr"
                        EmptyDataText="There are no data records to display." GridLines="None" OnRowDataBound="grvProposalSummary_RowDataBound"
                        DataKeyNames="RefCEUserId,CECarId" OnSorting="grvProposalSummary_Sorting">
                        <Columns>
                            <asp:BoundField DataField="SubmitedDate" DataFormatString="{0:dd/MM/yyyy hh:mm:ss tt}"
                                HeaderText="Date of Completed" SortExpression="SubmitedDate" />
                            <asp:BoundField DataField="QuoteRefNo" HeaderText="Reference No." SortExpression="QuoteRefNo" />
                            <asp:BoundField DataField="ProposerName" HeaderText="Applicant's Name" SortExpression="ProposerName" />
                            <%--<asp:BoundField DataField="ProposerName" HeaderText="Applicant's Name" SortExpression="ProposerName" Visible="false" />--%>
                            <asp:BoundField DataField="RefCEUserId" HeaderText="UserId" SortExpression="RefCEUserId" />
                            <asp:BoundField DataField="InsuranceType" HeaderText="Insurance Type" SortExpression="InsuranceType" />
                            <asp:BoundField DataField="ApplicationType" HeaderText="App Type" SortExpression="ApplicationType" />
                            <asp:BoundField DataField="CompanyName" HeaderText="Insurer" SortExpression="CompanyName" />
                            <asp:BoundField DataField="Package" HeaderText="Plan Name" SortExpression="Package" />
                            <asp:BoundField DataField="AnnualPremium" HeaderText="TotalPremium(฿)" DataFormatString="฿{0:#,0.00}"
                                SortExpression="AnnualPremium" />
                            <asp:BoundField DataField="FinalAnnualPremium" HeaderText="CollectedPremium(฿)" DataFormatString="฿{0:#,0.00}"
                                SortExpression="FinalAnnualPremium" />
                            <asp:BoundField DataField="ProviderCompanyId" Visible="false" HeaderText="ProviderCompanyId"
                                SortExpression="ProviderCompanyId" />
                            <asp:BoundField DataField="RefCEUserId" Visible="false" HeaderText="RefCEUserId"
                                SortExpression="RefCEUserId" />
                            <asp:HyperLinkField DataNavigateUrlFields="RefCEUserId" Target="_blank" HeaderText="Applicant"
                                Text="Applicant" DataNavigateUrlFormatString="~/user/search_user.aspx?ceid={0}&menu=0" />
                            <asp:HyperLinkField DataNavigateUrlFields="CECarId,RefCEUserId,ProviderCompanyId"
                                Target="_blank" HeaderText="Documents" Text="Documents" DataNavigateUrlFormatString="~/car/ci-documents-download.aspx?refid={0}&uid={1}&pid={2}&menu=0" />
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle CssClass="admin_gridheader" />
                        <EditRowStyle />
                        <AlternatingRowStyle CssClass="admin_gridodd" />
                        <RowStyle CssClass="admin_grideven" />
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnExport" runat="server" Text="Export" Visible="false" OnClick="btnExport_Click" />
                </td>
            </tr>
            <asp:Panel ID="pnlExport" runat="server" Visible="false">
                <tr>
                    <td>
                        <asp:GridView ID="grvExport" runat="server" AllowSorting="False" AutoGenerateColumns="False"
                            CellSpacing="3" CellPadding="3" Width="100%" CssClass="admin_gridstyle" PagerStyle-CssClass="pgr"
                            EmptyDataText="There are no data records to display." GridLines="None" DataKeyNames="CECarId"
                            OnRowDataBound="grvExport_RowDataBound">
                            <Columns>
                                <asp:BoundField DataField="SubmitedDate" HeaderText="Date of Submission" SortExpression="SubmitedDate" />
                                <asp:BoundField DataField="QuoteRefNo" HeaderText="Reference No." SortExpression="QuoteRefNo" />
                                <asp:BoundField DataField="ProposerName" HeaderText="Applicant's Name" SortExpression="ProposerName" />
                                <%--<asp:BoundField DataField="ProposerName" HeaderText="Applicant's Name" SortExpression="ProposerName" Visible="false" />--%>
                                <asp:BoundField DataField="RefCEUserId" HeaderText="UserId" SortExpression="RefCEUserId" />
                                <asp:BoundField DataField="InsuranceType" HeaderText="Insurance Type" SortExpression="InsuranceType" />
                                <asp:BoundField DataField="ApplicationType" HeaderText="App Type" SortExpression="ApplicationType" />
                                <asp:BoundField DataField="CompanyName" HeaderText="Insurer" SortExpression="CompanyName" />
                                <asp:BoundField DataField="Package" HeaderText="Plan Name" SortExpression="Package" />
                                <asp:BoundField DataField="AnnualPremium" HeaderText="TotalPremium(฿)" DataFormatString="฿{0:#,0.00}"
                                    SortExpression="AnnualPremium" />
                                <asp:BoundField DataField="FinalAnnualPremium" HeaderText="CollectedPremium(฿)" DataFormatString="฿{0:#,0.00}"
                                    SortExpression="FinalAnnualPremium" />
                            </Columns>
                            <FooterStyle />
                            <PagerStyle />
                            <SelectedRowStyle />
                            <HeaderStyle CssClass="admin_gridheader" />
                            <EditRowStyle />
                            <AlternatingRowStyle CssClass="admin_gridodd" />
                            <RowStyle CssClass="admin_grideven" />
                        </asp:GridView>
                    </td>
                </tr>
            </asp:Panel>
        </table>
    </div>

    <script type="text/javascript">
        function OpenProposal(refid) {
            var winl = (screen.width - 800) / 2;
            var wint = (screen.height - 500) / 2;
            var settings = 'height=500,';
            settings += 'width=800,';
            settings += 'top=' + wint + ',';
            settings += 'left=' + winl + ',';
            settings += 'scrollbars=yes,';
            settings += 'resizable=No';
            window.open('application-download.aspx?Ref=' + refid, 'NEWWIN', settings);
        }
    </script>

</asp:Content>
